﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace ExiaWorkshopServicesE2
{
    class CL_getDataFile
    {
        public STC_Data getDataFile(string filePath)
        {
            DirectoryInfo directoryInfo = new DirectoryInfo(filePath);

            STC_Data structData = new STC_Data();
            structData.lst_filesINF = new List<FileInfo>();
            structData.lst_writeTime_file = new List<DateTime>();
            structData.totalFileSize = 0;

            structData.dirINF = directoryInfo.Name;
            structData.lst_filesINF = directoryInfo.GetFiles().ToList();

            foreach (var fsINF in structData.lst_filesINF)
            {
                structData.totalFileSize = structData.totalFileSize + fsINF.Length;
                structData.lst_writeTime_file.Add(fsINF.LastWriteTime);
            }

            structData.files_count = structData.lst_filesINF.Count;

            return structData;
        }
    }
}
